<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script type="text/javascript">
       
        (function(x){
           if (typeof WeixinJSBridge == "undefined"){
                if( document.addEventListener ){
                    document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                }else if (document.attachEvent){
                    document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
                    document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                }
            }else{
                jsApiCall();
            }
            
            function jsApiCall(){
                var  options = '{$options}';
                     options =JSON.parse(options);
                WeixinJSBridge.invoke(
                    'getBrandWCPayRequest',options ,
                     function(res){
                        alert(JSON.stringify(res));
                        // WeixinJSBridge.log(res.err_msg);
                        // alert(res.err_code+res.err_desc+res.err_msg);
                    }
                );
            }
        })(document.body)
    </script>
<script type="text/javascript">

</script>
</body>
</html>